#include <iostream>
#include <signal.h>
#include <unistd.h>

#include <sys/wait.h>
using namespace std;

void handler(int sig)
{
    if (sig == SIGINT)
    {
        cout << "SIGINT" << endl;
        sleep(5);
    }
    exit(-1);
}

int main()
{
    struct sigaction act, oact;
    act.sa_handler = handler;
    act.sa_flags = 0;
    sigemptyset(&act.sa_mask);
    sigaddset(&act.sa_mask, 2);
    sigaction(2,&act,&oact);

    cout << getpid() << endl;
    while (1)
    {
        sleep(1);
    }

    return 0;
}